import httpRequest from "@/utils/axios";

const get = (url: string) =>
  httpRequest({
    url: url,
    method: "GET",
  });

const post = (url: string, params: any) =>
  httpRequest({
    url: url,
    method: "POST",
    data: params,
  });
/**
 * 首页控制台
 * @author Godz
 */
export class firstMain {}

/**
 * 轮播图区域打字机动画
 * @author Godz
 */
export class typewriter {
  /** 查询全部 */
  static allGet = () => get(`/index/get/indexTw`);
  /** 查询单个 */
  static getOne = (id: any) => get(`/index/get/indexTw/${id}`);
  /** 增加一个 */
  static add = (param: any) => post(`/index/post/addTw`, param);
  /** 修改一个 */
  static edit = (param: any) => post(`/index/post/editTw`, param);
  /** 删除单个 */
  static delete = (id: any) => get(`/index/get/deleteTw/${id}`);
}

/**
 * 我的日记
 * @author Godz
 */
export class journal {
  /** 查询全部 */
  static allGet = (pageNow: any) =>
    get(`/index/get/indexMyStory?pageNow=${pageNow}`);
  /** 查询重要 */
  static getImportant = (pageNow: any) =>
    get(`/index/get/indexMyStoryI?pageNow=${pageNow}`);
  /** 根据条件查询数据 */
  static getCondition = (content: any) => get(`/queryStory/${content}`);
  /** 根据条件查询重要数据 */
  static getICondition = (content: any) => get(`/queryStoryI/${content}`);
  /** 查询页数 */
  static pageNumber = () => get(`/index/get/indexMyStory/pageAll`);
  /** 查询重要页数 */
  static pageINumber = () => get(`/index/get/indexMyStoryI/pageAll`);
  /** 查询单个 */
  static getOne = (id: any) => get(`/index/get/indexMyStory/${id}`);
  /** 增加一个 */
  static add = (param: any) => post(`/index/post/addStory`, param);
  /** 修改一个 */
  static edit = (param: any) => post(`/index/post/editStory`, param);
  /** 删除单个 */
  static delete = (id: any) => get(`/index/get/deleteStory/${id}`);
}
/**
 * 伟人名言警句
 * @author Godz
 */
export class aphorisms {
  /** 查询全部 */
  static allGet = () => get(`/index/get/indexSay`);
  /** 查询单个 */
  static getOne = (id: any) => get(`/index/get/indexSay/${id}`);
  /** 增加一个 */
  static add = (param: any) => post(`/index/post/addSay`, param);
  /** 修改一个 */
  static edit = (param: any) => post(`/index/post/editSay`, param);
  /** 删除单个 */
  static delete = (id: any) => get(`/index/get/deleteSay/${id}`);
}
/**
 * 个人信息
 */
export function apiGetPi() {
  return get(`/index/get/indexPi`);
}
interface Form {
  id: number;
  piName: string;
  piPd: string;
  piSiFirst: string;
  piSiSecond: string;
}
//修改
export function piEdit(param: Form) {
  return post(`/index/post/editPi`, param);
}
